package edu.johnpank.libassistant.entity

import java.io.Serializable
import javax.persistence.*

@Entity
class BorrowedBook: Serializable {

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    val id: Long? = null

    @Column(nullable = false)
    var bookId: Long = 0L

    @Column(nullable = false)
    var readerId: Long = 0L

    @Column(nullable = false)
    var borrowDate: Long = 0L

    @Column(nullable = false)
    var returnDate: Long = 0L

    @Column(nullable = false)
    var returned: Boolean = false

    override fun toString(): String {
        return "BorrowedBook(id=$id, bookId=$bookId, readerId=$readerId, borrowDate=$borrowDate, returnDate=$returnDate, isReturned=$returned)"
    }

}
